package com.ratta.supernote.note.plugincore.modules;


import android.util.Log;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.ratta.supernote.note.plugincore.NativePluginManagerSpec;
import com.ratta.supernote.note.plugincore.core.PluginAppAPI;
import com.ratta.supernote.note.plugincore.utils.DeviceUtils;

/**
 * Module for getting Plugin information from RN side
 */
public class PluginModule extends NativePluginManagerSpec {
    private final String TAG = NAME;
    PluginAppAPI pluginApp;

    public PluginModule(ReactApplicationContext reactContext, PluginAppAPI pluginApp) {
        super(reactContext);
        this.pluginApp = pluginApp;
    }

    @Override
    public void getPluginDirPath(Promise promise) {

        Log.i(TAG, "getPluginDirPath pluginPath:"+pluginApp.getPluginPath());
        promise.resolve(pluginApp.getPluginPath());
    }

    @Override
    public void getPluginName(Promise promise) {
        promise.resolve(pluginApp.getName());
    }

    @Override
    public void getDeviceType(Promise promise) {
        promise.resolve(DeviceUtils.getDeviceType());
    }
}
